import router from "./router";
import Store from '@/store'

// 前置守卫
router.beforeEach((to, from, next) => {
  const token = window.localStorage.getItem('token')
  if (token) {
    if (to.name == 'login' ) {
      next({name:'课题管理', name:'二级课题管理',name:'专家主页'})
      return;
    } else {
      next()
      return;
    }
  } else {
    if (to.name == 'login') {
      next()
      return
    } else {
      next({ name: 'login' })
      return
    }
  }
  // 
  
})
// 后置守卫
router.afterEach((to) => {
})

export default router